package c1764;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

/**
 * 连续和
 * 数论算法：（枚举因子，解方程）
 * 复杂度:O(sqrt(N))
 * N<1e18
 */

public class F04SqrtN {

    public static void main(String[] args) {//O(sqrt(N))
        long start = System.currentTimeMillis();
        long n = 1500000000000L;
        long m = n * 2;
        for (long i = (long) Math.sqrt(m); i > 1; i--) {
            if (m % i == 0) {
                long j = m / i;
                //p+q=j;
                //q-p+1=i;
                //=> p=(j-i+1)/2  q=(i+j-1)/2;
                long p = (j - i + 1) / 2;
                long q = (i + j - 1) / 2;
                if (p < q && m == (p + q) * (q - p + 1))
                    System.out.println(p + " " + q);
            }

        }
        long end = System.currentTimeMillis();
        System.out.println((end - start) / 1000.0 + " second(s).");
    }


    static Scanner cin = null;

    static {
        try {
            cin = new Scanner(new FileReader(new File("test.in")));
        } catch (FileNotFoundException e) {
            cin = new Scanner(System.in);
        }
    }
}